//
//  ViewController.m
//  AppTwo
//
//  Created by mac on 2019/2/25.
//  Copyright © 2019 YangYang. All rights reserved.
//

#import "ViewController.h"
#import "TwoViewController.h"
#import "AppDelegate.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    NSURL *url = ((AppDelegate *)[UIApplication sharedApplication].delegate).url;
    NSString *urlString = [NSString stringWithFormat:@"url = %@,host = %@",[url absoluteString],[url host]];
    
    GGLog(@"urlString = %@",urlString);
    
    if ([[url host]isEqualToString:@"openBSecondPage"]) {
        //跳转到第二个界面
        TwoViewController *twoVC = [[TwoViewController alloc] init];
        [self presentViewController:twoVC animated:YES completion:nil];
    }
    
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, [UIScreen mainScreen].bounds.size.width, 180)];
    [self.view addSubview:label];
    label.text = [NSString stringWithFormat:@"第二个APP\n%@\n%@",url.absoluteString,urlString];
    label.font = [UIFont systemFontOfSize:20];
    label.textColor = [UIColor lightGrayColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.numberOfLines = 0;
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    
}

@end
